#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QAudioInput>
#include <QAudioOutput>
#include <QBuffer>
#include <QNetworkAccessManager>
#include <QTimer>
#include <QThread>
#include "baiduspeech.h"
#include "music.h"

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();

    int judge(QString str);
    int music_unit(QString str);
    void start_time();
private slots:
    void asr_finished_slot();
    void tts_finished_slot();
    void play_state_slot(QAudio::State s);
    void on_reply(QNetworkReply*);
    void on_time();
    void music_end();
    void error_speech();
public slots:

public:

    QAudioInput* recorder;
    QAudioOutput* player;
    QBuffer* asrbuf;
    QBuffer* ttsbuf;
    BaiduSpeech* bds;
    QNetworkAccessManager* client;
    Music* music_player;
    QTimer*time;

};

#endif // WIDGET_H
